import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RoomDetailsVO, RoomGroupVO, RoomDetailsForm, RoomDetailsQuery } from '@/api/tearoom/roomDetails/types';

/**
 * 查询茶室详情列表
 * @param query
 * @returns {*}
 */

export const listRoomDetails = (query?: RoomDetailsQuery): AxiosPromise<RoomDetailsVO[]> => {
  return request({
    url: '/tearoom/roomDetails/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询茶室详情列表
 * @param query
 * @returns {*}
 */

export const listRoomDetailsByRegionalId = (groupIds?: string | number | Array<string | number>): AxiosPromise<RoomDetailsVO[]> => {
  return request({
    url: '/tearoom/roomDetails/listByGroupId/'+groupIds,
    method: 'get'
  });
};

/**
 * 查询茶室详情详细
 * @param id
 */
export const getRoomDetails = (id: string | number): AxiosPromise<RoomDetailsVO> => {
  return request({
    url: '/tearoom/roomDetails/' + id,
    method: 'get'
  });
};

/**
 * 新增茶室详情
 * @param data
 */
export const addRoomDetails = (data: RoomDetailsForm) => {
  return request({
    url: '/tearoom/roomDetails',
    method: 'post',
    data: data
  });
};

/**
 * 修改茶室详情
 * @param data
 */
export const updateRoomDetails = (data: RoomDetailsForm) => {
  return request({
    url: '/tearoom/roomDetails',
    method: 'put',
    data: data
  });
};

/**
 * 删除茶室详情
 * @param id
 */
export const delRoomDetails = (id: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/roomDetails/' + id,
    method: 'delete'
  });
};

/**
 * 恢复茶室
 * @param id
 */
export const recoverRoomDetails = (id: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/roomDetails/recover/' + id,
    method: 'put'
  });
};

/**
 * 永久删除茶室
 * @param id
 */
export const foreverDeleteRoomDetails = (id: string | number | Array<string | number>) => {
  return request({
    url: '/tearoom/roomDetails/foreverDelete/' + id,
    method: 'delete'
  });
};


export const querygroupDetails = (): AxiosPromise<RoomGroupVO[]> => {
  return request({
    // 请求的URL
    url: '/tearoom/regionalInfo/selectGroup',
    method: 'get'
  });
};

export const getRoomList = (): AxiosPromise<RoomDetailsVO[]> => {
  return request({
    url: '/tearoom/roomDetails/wechat/rmlist',
    method: 'get'
  });
};
